<template>
  <view class="success-modal-overlay" v-if="visible" @click="handleClose">
    <view class="success-modal" @click.stop>
      <view class="success-header">
        <text class="success-title">{{ title }}</text>
      </view>
      <view class="success-body">
        <text class="success-message">{{ message }}</text>
      </view>
      <view class="success-footer">
        <view class="success-btn" @click="handleClose">
          <text class="success-btn-text">{{ buttonText }}</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue'

// 定义props
const props = defineProps({
  visible: {
    type: Boolean,
    default: false
  },
  title: {
    type: String,
    default: '提交成功'
  },
  message: {
    type: String,
    default: '您发起的提现正在审核中，一般1-3个工作日到账，请耐心等待。'
  },
  buttonText: {
    type: String,
    default: '我知道了'
  }
})

// 定义事件
const emit = defineEmits(['close'])

// 处理关闭事件
const handleClose = () => {
  emit('close')
}
</script>

<style scoped>
/* 成功弹窗样式 */
.success-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}

.success-modal {
  width: 560rpx;
  background: #fff;
  border-radius: 20rpx;
  position: relative;
  animation: successModalSlideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

@keyframes successModalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.success-header {
  padding: 60rpx 40rpx 0;
  display: flex;
  justify-content: center;
}

.success-title {
  font-size: 36rpx;
  font-weight: bold;
  color: #333;
  text-align: center;
}

.success-body {
  padding: 40rpx 40rpx 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-message {
  font-size: 28rpx;
  color: #666;
  line-height: 1.6;
  text-align: center;
}

.success-footer {
  padding: 60rpx 40rpx 40rpx;
}

.success-btn {
  width: 100%;
  height: 88rpx;
  background: #f5315c;
  border-radius: 44rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-btn-text {
  font-size: 28rpx;
  color: #fff;
  font-weight: bold;
}
</style>